home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / WINDOWS / MSWLOG12.ARJ / PUTDISK.LG < prev    next >
Text File  |  1992-07-22  |  915b  |  37 lines

  1. to putdisk :tnum :dnum :state
  2. !
  3. ! Called by HANOI to put a disk on a tower.
  4. ! first arg. is number of tower (1,2 or 3)
  5. ! second arg. is number of disk to draw (1 is smallest)
  6. ! third arg. is "final, "temp, or "erase depending on whether
  7. !   disk is drawn in final state, in temporary state to indicate
  8. !   motion, or is being erased (removed from this tower)
  9. ! Note that this procedure re-draws the tower correctly.
  10. !
  11. local "tc
  12. local "halfsize
  13. make "tc towercnt :tnum
  14. make "halfsize sum 20 product :dnum 10
  15. pu
  16. if :tnum = 1 [setxy "-240 "-100] [if :tnum = 2 [setxy "-15 "-100] [setxy 210 "-100]]
  17. pe
  18. fd product 30 :tc
  19. pu
  20. setxy xcor - :halfsize ycor
  21. pd
  22. if :state = "final [pencolor 0 255 0] [if :state = "temp [pencolor 0 0 255] [pe]]
  23. fd 30
  24. rt 90
  25. fd product :halfsize 2
  26. rt 90
  27. fd 30
  28. rt 90
  29. pu
  30. fd :halfsize
  31. rt 90
  32. pencolor 255 0 0
  33. if :state = "erase [pd; fd 30] [pe; fd 30]
  34. oflush
  35. end
  36.  
  37.